<?php
namespace app\admin\controller;
use cmf\controller\AdminBaseController;
use app\admin\model\HookModel;
use app\admin\model\PluginModel;
use app\admin\model\HookPluginModel;
use think\Db;

/**
 * 获取后台信息流
 * @package app\admin\controller
 */
class SystemyController extends AdminBaseController
{
  	public function orderlist()
    {
      	$uid = $this->request->param('uid');
		$where['money']=array('gt',0);
        if ($uid) {
            $where['uid'] = $uid;
        }

      	$openlist = Db::name('pay')->where($where)->order("id DESC")->paginate(10);
        // 获取分页显示
        $page = $openlist->render();
        $this->assign("page", $page);
      	$this->assign('list',$openlist);
        return $this->fetch();
    }
    public function zhuanlog(){
    	$uid = $this->request->param('uid');
		$where['money']=array('gt',0);
        if ($uid) {
            $where['user_login'] = $uid;
        }
      	$openlist = Db::name('moneylog')->where($where)->order("id DESC")->paginate(14);
        // 获取分页显示
        $page = $openlist->render();
        $this->assign("page", $page);
      	$this->assign('list',$openlist);
        return $this->fetch();
    }
  	public function withdraw()
    {
      	echo date('H:i:s');
      	$uid = $this->request->param('uid');
		$where['money']=array('gt',1);
        if ($uid) {
            $where['uid'] = $uid;
        }
      	$openlist = Db::name('withdraw')->where($where)->order("id DESC")->paginate(10);
        // 获取分页显示
        $page = $openlist->render();
        $this->assign("page", $page);
      	$this->assign('list',$openlist);
        return $this->fetch();
    }
  	public function kailist()
    {
    	$uid = $this->request->param('uid');
		$where['money']=array('gt',0);
		$where['user']=array('gt',1000);
        if ($uid) {
            $where['user'] = $uid;
        }
      	$openlist = Db::name('neworders')->where($where)->order("id DESC")->paginate(14);
        // 获取分页显示
        $page = $openlist->render();
        $this->assign("page", $page);
      	$this->assign('list',$openlist);
        return $this->fetch();
    }
  	public function bzkjlist()
    {
      	$openlist = Db::name('newopen')->order("id DESC")->paginate(14);
        // 获取分页显示
        $page = $openlist->render();
        $this->assign("page", $page);
      	$this->assign('list',$openlist);
        return $this->fetch();
    }
  	public function paylist()
    {
      	$uid = $this->request->param('uid');
		$where['money']=array('gt',0);
        if ($uid) {
            $where['user_login'] = $uid;
        }
      	$openlist = Db::name('newopen')->where($where)->order("id DESC")->paginate(14);
        // 获取分页显示
        $page = $openlist->render();
        $this->assign("page", $page);
      	$this->assign('list',$openlist);
        return $this->fetch();
    }
  	public function bzpaylist()
    {
      	$uid = $this->request->param('uid');
		$where['money']=array('gt',1);
        if ($uid) {
            $where['user'] =$uid;
        }
      	$gamexz_type=array(
		        '1'=>"天",
		        '2'=>"地",
		 );
      	$openlist = Db::name('neworders')->where($where)->order("id DESC")->paginate(14);
        // 获取分页显示
        $page = $openlist->render();
      	$this->assign('xztypesss',$gamexz_type);
        $this->assign("page", $page);
      	$this->assign('list',$openlist);
        return $this->fetch();
    }
  	public function huobilist()
    {
      	$uid = $this->request->param('uid');
		$where['money']=array('gt',0);
        if ($uid) {
            $where['user'] =$uid;
        }
      	$openlist = Db::name('yjjl')->where($where)->order("id DESC")->paginate(14);
        // 获取分页显示
        $page = $openlist->render();
        $this->assign("page", $page);
      	$this->assign('list',$openlist);
        return $this->fetch();
    }
  	public function adminjine()
    {
		$uid = $this->request->param('uid');
      	$money = $this->request->param('money');
      	Db::name('user')->where('id', $uid) ->setInc('balance',$money);
      	$arr['order']='R'.time().mt_rand(11,99).'_'.$uid;
        $arr['uid']=$uid;
        $arr['addtime']=date("Y-m-d H:i:s");
        $arr['status']=0;
       	$arr['money']=$money;
        $arr['price']=$money;
        $arr['type']='管理员更改余额';
      	Db::name('pay')->insert($arr);
      	$this->success('完成',url('user/admin_index/index'),['id'=>1],1);

    }
  	public function adminhuobi()
    {
		$uid = $this->request->param('uid');
      	$money = $this->request->param('money');
      	Db::name('user')->where('id', $uid) ->setInc('score',$money);    
      	$arr['order']='R'.time().mt_rand(11,99).'_'.$uid;
        $arr['uid']=$uid;
        $arr['addtime']=date("Y-m-d H:i:s");
        $arr['status']=0;
       	$arr['money']=$money;
        $arr['price']=$money;
        $arr['type']='管理员更改佣金';
      	Db::name('pay')->insert($arr);
      	$this->success('完成',url('user/admin_index/index'),['id'=>1],1);
    }
}